﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using TiEntityObject.Notification;
using TI_EntityLib.TiEntityObjects.AttachInfo;

namespace TI
{
    public class DocumentMetaItem:ICloneable {
        public long OwnerID { get; set; }
       
        public string DocID { get; set; }
        
        public int Part { get; set; }
        
        public string URL{get;set;}
        
        public string FileName { get; set; }
        
        public bool IsDownload { get; set; }
        
        public bool IsIndexed { get; set; }
        
        public bool IsHtml { get; set; }
        
        public long iTransportDay { get; set; }
        
        public string PublicFileName { get { return DocID + FileExt; } }
        
        public string FileExt {
            get {
                FileInfo i = new FileInfo(FileName);
                return i.Extension  ;
            }
        }
        
        public override string ToString()
        {
            return Helper.Json<DocumentMetaItem>.NewtonSerializeObject(this);
        }
      
        public TagInfo TagInfo { get; set; }

        /// <summary>
        /// Признак завершение обработки первого этапа
        /// </summary>
        public bool FirstStepIsOK { get; set; }

        /// <summary>
        /// Признак завершение обработки второго этапа
        /// </summary>
        public bool SecondStepIsOK { get; set;}
        
        public List<TDocumentTable> AttachTables { get; set; }
    
        public string GetFullID { get { if (Part == 0) return DocID; return DocID + "_" + Part.ToString(); } }
        
        #region ICloneable Members

        public object Clone()
        {
            DocumentMetaItem r = new DocumentMetaItem();
            r.DocID = this.DocID;
            r.OwnerID = this.OwnerID;
            r.URL = this.URL;
            r.IsDownload = this.IsDownload;
            r.IsIndexed = this.IsIndexed;
            r.iTransportDay = this.iTransportDay; 
            return r;
        }

        #endregion
    }


  
}
